#define _CRT_SECURE_NO_WARNINGS 1

#include <string>
#include <iostream>

using namespace std;
int main()
{
	char str[1000];
	while (cin >> str)
	{
		string s1;
		string s2;
		string s3;
		for (int i = 0; str[i] != '\0'; ++i)
		{
			if (str[i] >= 'a' && str[i] <= 'z' || str[i] >= 'A' && str[i] <= 'Z')
			{
				s1 += str[i];
			}
			else
			{
				if (str[i] >= '0' && str[i] <= '9')
					s2 += str[i];
				else
				{
					s3 += str[i];
				}
			}
		}
		cout << s1 << endl << s2 << endl << s3 << endl;
	}
	return 0;
}